﻿using Abp.EntityFramework;
using System.Data.Common;
using System.Data.Entity;
using Teleware.Newbe.Navigation.Web.Domain.Entities;

namespace Teleware.Newbe.Navigation.Web.Domain
{
    public class NewbeDbContext : AbpDbContext
    {
        public virtual IDbSet<Account> Accounts { get; set; }
        public virtual IDbSet<Department> Departments { get; set; }
        public virtual IDbSet<HrefInfo> HrefInfos { get; set; }
        public virtual IDbSet<InfoTag> InfoTags { get; set; }
        public virtual IDbSet<HrefInfoTag> HrefInfoTags { get; set; }

        /* NOTE:
         *   Setting "Default" to base class helps us when working migration commands on Package Manager Console.
         *   But it may cause problems when working Migrate.exe of EF. If you will apply migrations on command line, do not
         *   pass connection string name to base classes. ABP works either way.
         */
        public NewbeDbContext()
            : base("Default")
        {
        }

        /* NOTE:
         *   This constructor is used by ABP to pass connection string defined in MyProjectDataModule.PreInitialize.
         *   Notice that, actually you will not directly create an instance of NewbeDbContext since ABP automatically handles it.
         */
        public NewbeDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {
        }

        //This constructor is used in tests
        public NewbeDbContext(DbConnection existingConnection)
            : base(existingConnection, false)
        {
        }

        public NewbeDbContext(DbConnection existingConnection, bool contextOwnsConnection)
            : base(existingConnection, contextOwnsConnection)
        {
        }
    }
}
